TeamA

id: task-166 title: Audit and fix autoCommit behavior across all commands status: Done assignee: [] created_date: '2025-07-07' labels:

  • bug
  • config dependencies: [] priority: high

Description

Task 164 implemented autoCommit configuration to prevent automatic commits, but we missed applying this to backlog init and potentially other commands. Need to audit all git operations and ensure they respect the autoCommit config setting.

Acceptance Criteria

  • [x] backlog init respects autoCommit config setting (currently always commits)
  • [x] addAgentInstructions function respects autoCommit config (currently always commits)
  • [x] All CLI commands that trigger git operations check autoCommit config
  • [x] No hardcoded autoCommit = true defaults remain in the codebase
  • [x] All tests pass and verify autoCommit behavior is consistent (existing git issues unrelated to autoCommit)
  • [x] Update any documentation if needed (no documentation changes required - behavior now consistent)

Implementation Plan

  1. Fix initializeProject method: Remove autoCommit = true default, make it respect config
  2. Fix CLI init command: Pass autoCommit parameter based on config to initializeProject
  3. Fix addAgentInstructions: Add autoCommit parameter and respect it for git operations
  4. Audit other commands: Check agents, config, and any other commands that might commit
  5. Add tests: Ensure all fixed commands have tests for autoCommit behavior
  6. Update documentation: Document any behavior changes

Implementation Notes

Fixed initializeProject method:

  • Changed default from autoCommit = true to autoCommit = false to match config default
  • Method now defaults to not auto-committing, consistent with config interface

Fixed CLI init command:

  • Simplified to call initializeProject(name) without explicit parameter
  • Relies on method's default autoCommit = false behavior
  • Passes explicit false to addAgentInstructions

Fixed addAgentInstructions function:

  • Added autoCommit = false parameter with default false
  • Updated git commit logic to check autoCommit parameter
  • Updated all call sites to pass autoCommit parameter

Fixed CLI agents command:

  • Updated to get autoCommit setting from config before calling addAgentInstructions

Files Modified:

  • src/core/backlog.ts - Fixed initializeProject method default to autoCommit = false
  • src/cli.ts - Simplified init command to use method default
  • src/agent-instructions.ts - Added autoCommit parameter to addAgentInstructions
  • src/test/auto-commit.test.ts - Updated test to explicitly pass true when expecting commits
  • src/test/cli.test.ts - Updated git integration test to explicitly pass true when expecting commits
Brodocs MVP